package hlhj.fhp.checkpoint.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.lzy.okgo.model.Response
import hlhj.fhp.checkpoint.http.Apis
import hlhj.fhp.checkpoint.http.CustomAction
import hlhj.fhp.checkpoint.http.LoadingAction
import hlhj.fhp.checkpoint.iview.ActiveView

/**
 * Created by Never Fear   on 2018\11\28 0028.
Never More....
 */
class ActiveModule :BaseModule {
    var listener:ActiveView?=null

    fun getActivePayOrder(type:Int,c:Context){
        Apis.acitvePay(type)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<String>>(c){
                                override fun httpSuccess(t: Response<String>) {
                                    listener?.setActiveOrderSign(t.body())
                                }
                            })
                }
    }
}